define(['hammer'], function() {
	var addincart = $('.colorAndsize');
	var addcartMask = $('.addcart-mask');
	var faClose = $('.fa-close');
	var addinto = new Hammer(addincart[0]);
	addinto.on('tap', function() {
		$(addcartMask[0]).show();
	});
	var Close = new Hammer(faClose[0]);
	Close.on('tap', function() {
		$(addcartMask[0]).hide();
	});
	var chose1 = $('.addc1 a');
	var sizeSelected = $('#sizeSelected');
	var stocknum = $('#stocknum');
	var arrys1 = ['45', '34', '123', '345'];
	chose1.each(function(i, v) {
		new Hammer(v).on('tap', function() {
			if(!chose1[i].className) {
				for(var j = 0; j < chose1.length; j++) {
					if(i === j) {
						$(chose1[j]).addClass('current');
						sizeSelected.text('已选择：' + $(chose1[j]).text());
						stocknum.text(arrys1[j]);
					} else {
						$(chose1[j]).removeClass('current');
					}
				}
			} else {
				$(chose1[i]).removeClass('current');
				stocknum.text(1589);
			}
		});
	});
	var chose2 = $('.addc2 a');
	var colorSelected = $('#colorSelected');
	var arrys2 = ['45', '34'];
	chose2.each(function(i, v) {
		new Hammer(v).on('tap', function() {
			if(!chose2[i].className) {
				for(var j = 0; j < chose2.length; j++) {
					if(i === j) {
						$(chose2[j]).addClass('current');
						colorSelected.text('已选择：' + $(chose2[j]).text());
						stocknum.text(arrys2[j]);
					} else {
						$(chose2[j]).removeClass('current');
					}
				}
			} else {
				$(chose2[i]).removeClass('current');
				stocknum.text(1589);
			}
		});
	});
	var OverlayBottom = $('.Overlay-bottom');
	var cartNum = $('#cart-num');
	var overBtn = new Hammer(OverlayBottom[0]);
	overBtn.on('tap', function() {
		if(chose2[0].className === '' && chose1[0].className === '') {
			console.info('你还没有选择颜色和尺码！');
		}
		if(chose1[0].className === '') {
			console.info('你还没有选择尺码！');
		}
		if(chose2[0].className === '') {
			console.info('你还没有选择颜色!');
		}else{
			$(addcartMask[0]).hide();
			cartNum.text(1)
		}
	});
})